#lang racket


(require "range.rkt")

(provide assert-type
         assert-types)


(define (assert-type fn-sym type-fn n-arg args)
  (unless (type-fn (list-ref args n-arg))
    (apply raise-type-error fn-sym (symbol->string (object-name type-fn)) n-arg args)))

(define (assert-types fn-sym type-fns args)
  (for-each
   (λ (type-fn i)
     (assert-type fn-sym type-fn i args))
   type-fns
   (: (length type-fns))))